/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package View


/**
 *
 * @author Juan
 */
import groovy.swing.SwingBuilder
import java.awt.BorderLayout as BL
import static javax.swing.JFrame.EXIT_ON_CLOSE 
import entity.Order
import javax.swing.JScrollPane
import javax.swing.JSlider

count = 0
FPS_MIN = 0;
FPS_MAX = 1000;
FPS_INIT = 500;
new SwingBuilder().edt {
  frame(title:'Order View', size:[1300,700], show: true) {
    borderLayout()
    textlabel = label(text:"Wood Statistics", constraints: BL.NORTH)
    
       
  
        scrollPane(constraints: BL.WEST) {
                    table() {
                        def model = [['type':'Cherry', 'price':'$5.95', 'time':'0.5'],['type':'Curly Maple', 'price':'$6.00', 'time':'1.5'],
                                    ['type':'Genuine Mahogany', 'price':'$9.60', 'time':'3.0'],['type':'Wenge', 'price':'$22.35', 'time':'5.0'],
                                    ['type':'Sawdust', 'price':'$1.5', 'time':'1.5']]

                        tableModel(list:model) {
                            closureColumn(header:'Hardwood Type', read:{row -> return row.type})
                            closureColumn(header:'Price', read:{row -> return row.price})
                            closureColumn(header:'Delivery Time', read:{row -> return row.time})
                        }
                    }
                }

        
        panel( constraints: BL.EAST, border: compoundBorder([emptyBorder(10), titledBorder('Please insert the order description')])) {
            
            
            lcherry = label(text:"Cherry")
            slidercherry = slider(minimum:FPS_MIN, maximum:FPS_MAX,value:FPS_INIT)            
            valorcherry = label(text:slidercherry.value)
            
            lcurly = label(text:"Curly Maple")
            slidercurly = slider(minimum:FPS_MIN, maximum:FPS_MAX,value:FPS_INIT)            
            valorcherry = label(text:slidercurly.value)
            
            lmahogany = label(text:"Genuine Mahogany")
            slidermahogany = slider(minimum:FPS_MIN, maximum:FPS_MAX,value:FPS_INIT)            
            valorcherry = label(text:slidermahogany.value)
            
            lwenge = label(text:"Wenge")
            sliderwenge = slider(minimum:FPS_MIN, maximum:FPS_MAX,value:FPS_INIT)            
            valorcherry = label(text:sliderwenge.value)
            
            lsawdust = label(text:"Sawdust")
            slidersaw = slider(minimum:FPS_MIN, maximum:FPS_MAX,value:FPS_INIT)            
            valorcherry = label(text:slidersaw.value)
                        
                    
                   // def order = new Order(woods:[1:100, 4:250]);

           

        }
       
        

        
  }                
}
